﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Money.Interfaces;
using Money.Data;
using Money.Entities;

namespace Money.Services
{
    public class AccountTypeService : IAccountTypeService
    {

        Money.Data.MoneyManagerDataContext context = new MoneyManagerDataContext();

        public AccountTypeService()
        {
            context = new MoneyManagerDataContext();
        }

        public List<AccountType> GetAccountTypes()
        {
            return context.AccountTypes.ToList<AccountType>();
        }

        public AccountType GetAccountTypeById(int id)
        {
            return context.AccountTypes.SingleOrDefault<AccountType>(ac => ac.Id == id);
        }
    }
}
